package acwing._1_1AlgorithmBasic;

/**
 * @Project : AlgorithmLearning
 * @Package : ACWing._1_1AlgorithmBasic
 * @File : _4_3CombinatorialNumber.java
 * @Author : WangRuoyu
 * @Date : 2023/4/5 10:17
 */

public class _4_3CombinatorialNumber {
    /*******求组合数*******/
    // 1 递推
    static int[][] cNums() {
        final int MOD = 1000000007;
        int[][] res = new int[2001][2001];
        for (int i = 0; i <= 2000; ++i) {
            for (int j = 0; j <= 2000; ++j) {
                if (i < j) continue;
                if (j == 0 || j == i) {
                    res[i][j] = 1;
                } else {
                    res[i][j] = (res[i - 1][j - 1] + res[i - 1][j]) % MOD;
                }
            }
        }
        return res;
    }
    // 2 预处理
}
